package cn.iocoder.yudao.module.ao.dal.mysql.school;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.school.SchoolDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.school.vo.*;

/**
 * 学校信息 Mapper
 *
 * @author 禾安
 */
@Mapper
public interface SchoolMapper extends BaseMapperX<SchoolDO> {

    default PageResult<SchoolDO> selectPage(SchoolPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SchoolDO>()
                .likeIfPresent(SchoolDO::getSchoolName, reqVO.getSchoolName())
                .eqIfPresent(SchoolDO::getSchoolCode, reqVO.getSchoolCode())
                .eqIfPresent(SchoolDO::getSchoolType, reqVO.getSchoolType())
                .eqIfPresent(SchoolDO::getAddress, reqVO.getAddress())
                .eqIfPresent(SchoolDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(SchoolDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SchoolDO::getSchoolId));
    }

}